//package edu.xidian.bdilab.jrbigdata.security;
//import lombok.extern.log4j.Log4j2;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.authentication.configuration.EnableGlobalAuthentication;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.builders.WebSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
///**
// * @ClassName SpringSecurityConfig
// * @Description TODO
// * @Author tuantuan
// * @Date 2019/4/9 上午10:31
// * @Version 1.0
// * @Attention Copyright (C), 2004-2019, BDILab, XiDian University
// **/
//@Log4j2
//@Configuration
//@EnableWebSecurity
//@EnableGlobalMethodSecurity(prePostEnabled = true)
//public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Bean
//    public PasswordEncoder passwordEncoder(){
//        return new BCryptPasswordEncoder();
//    }
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        super.configure(http);
//        http
//                .authorizeRequests()
//                .antMatchers("/index.html").permitAll()
//                .antMatchers("/company.html","government.html","enterprise.html").authenticated()
//                .and()
//                .formLogin()
//                .permitAll()     .and()
//                .logout().permitAll();
//
//
////        http
//////                .httpBasic()//basic登录
////                .formLogin()//表单登录
////                .loginPage("/login.html")
////                //自定义表单登录URL
////                .loginProcessingUrl("/login/admin")
////                .and()
////                .authorizeRequests()
////                .antMatchers("/login.html").permitAll()
////                //访问登录页面时不需要身份认证
////                //剩下的请求需要认证
////                .anyRequest()
////                .authenticated();
//
//        // 关闭CSRF跨域防护
//        http.csrf().disable();
//    }
//
//    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//        auth
//                .inMemoryAuthentication()
//                .passwordEncoder(new BCryptPasswordEncoder())
//                .withUser("root")
//                .password(new BCryptPasswordEncoder().encode("12345"))
//                .roles("admin");
////        auth.inMemoryAuthentication()
////                .withUser("user")
////                .password("12345").and()
////                .passwordEncoder(new BCryptPasswordEncoder());
//    }
//
//    public void configure(WebSecurity web) throws Exception {
//        // 设置拦截忽略文件夹，可以对静态资源放行
//        web.ignoring().antMatchers("/css/**", "/js/**");
//    }
//
//}
